import { useDataMapping, useDigital, useLocale } from "@/hooks"
const useAgentRebateColumns = () => {
	const { newFormat } = useLocale()
	const { renderCopyNo, renderFormat } = useDigital()
	const { getFromDic } = useDataMapping()

	const orderNo = {
		dataIndex: "orderNo",
		title: newFormat("title.orderNo"),
		align: "center",
		width: 280,
		render: renderCopyNo
	}
	const auditNo = {
		dataIndex: "orderNo",
		title: newFormat("title.orderNo"),
		align: "center",
		width: 280,
		render: renderCopyNo
	}
	const cycleDate = {
		dataIndex: "cycleStartDate",
		title: newFormat("label.rebateCourse"),
		align: "center",
		width: 120
	}
	const payoutStatus = {
		dataIndex: "payoutStatus",
		title: newFormat("label.terminalStatus"),
		align: "center",
		width: 120,
		render: getFromDic("proxyPayoutStatus", false)
	}
	const proxyAccount = {
		dataIndex: "proxyAccount",
		title: newFormat("label.agentAccount"),
		width: 120,
		align: "center",
		render: renderCopyNo
	}
	const topProxyAccount = {
		dataIndex: "topProxyAccount",
		title: newFormat("label.topProxyName"),
		width: 120,
		align: "center",
		render: renderCopyNo
	}
	const parentProxyAccount1 = {
		dataIndex: "parentProxyAccount",
		title: newFormat("title.parentProxyName"),
		width: 120,
		align: "center",
		render: renderCopyNo
	}
	const rebateAccountStatus = {
		dataIndex: "accountStatus",
		title: newFormat("title.accountStatus"),
		align: "center",
		width: 120,
		render: (_text: string, record: any) => {
			return record.loginLockStatus === 1
				? newFormat("title.status.loginLock")
				: record.accountLockStatus === 1
				? newFormat("title.status.accountLock")
				: newFormat("title.status.normal")
		}
	}
	const personRebateAmount = {
		dataIndex: "personRebateAmount",
		title: newFormat("label.personalRebate"),
		align: "center",
		width: 120,
		render: renderFormat
	}
	const childRebateAmount = {
		dataIndex: "childRebateAmount",
		title: newFormat("label.childRebate"),
		align: "center",
		width: 120,
		render: renderFormat
	}
	const teamRebate = {
		dataIndex: "rebateAmount",
		title: newFormat("label.teamRebate"),
		align: "center",
		width: 120,
		render: renderFormat
	}
	const payoutTime1 = {
		dataIndex: "payoutTime",
		title: newFormat("label.dispatchDuration"),
		align: "center",
		width: 200
	}
	const rebateRemark = {
		dataIndex: "audit",
		title: newFormat("label.remarks"),
		align: "center",
		width: 120,
		render: (_text: string, record: any) => {
			return (
				<>
					<div>{record.audit1Desc}</div>
					<div>{record.audit2Desc}</div>
				</>
			)
		}
	}
	return {
		orderNo,
		cycleDate,
		payoutStatus,
		proxyAccount,
		topProxyAccount,
		parentProxyAccount1,
		rebateAccountStatus,
		personRebateAmount,
		childRebateAmount,
		teamRebate,
		payoutTime1,
		rebateRemark,
		auditNo
	}
}

export default useAgentRebateColumns
